﻿using System;

namespace ForLoop
{
    class Program
    {
        static void Main(string[] args)
        {
            int j = 0;

            while (j < 10)
            {
                // some action
                j++;
            }

            // alternative solution

            for (int i = 0; i < 10; i++)
            {
                // some action
            }
            // =================================================

            // Solution 1: recomended
            for (int k = 1; k <= 20; k += 2)
            {
                Console.WriteLine(k);
            }

            // Solution 2: not optimal
            for (int k = 1; k <= 20; k++)
            {
                if(k % 2 == 0)
                {
                    continue;
                }
                else
                {
                    Console.WriteLine(k);
                }
            }

            //====================================

            for (int i = 0; i < 100; i++)
            {
                if (i * 3 + i * i == 130)
                {
                    break;
                }

                if (i % 5 == 0)
                {
                    continue;
                }

                Console.WriteLine(i);
            }
        }
    }
}
